package com.example.task1.ui.AllService.parking;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.example.task1.R;
import com.example.task1.bean.ParkingPriceBean;
import com.example.task1.ui.BaseAdapter;

import java.util.ArrayList;
import java.util.List;

public class ParkingPriceAdapter extends BaseAdapter<ParkingPriceBean.RowsDTO> {

    private Context context;
    private List<ParkingPriceBean.RowsDTO> mData = new ArrayList<>();
    private TextView tvMoney;
    private TextView tvPlayType;
    private TextView tvTime;

    public ParkingPriceAdapter(Context context) {
        this.context = context;
    }

    @Override
    protected void setData(List<ParkingPriceBean.RowsDTO> rows) {
        mData.addAll(rows);
        notifyDataSetChanged();
    }

    @Override
    protected int getLayout() {
        return R.layout.parkingpricelist;
    }

    @Override
    protected Context getContext() {
        return null;
    }

    @Override
    protected List<ParkingPriceBean.RowsDTO> getData() {
        return mData;
    }

    @Override
    protected void onBind(myHolder holder, ParkingPriceBean.RowsDTO date) {
        tvMoney.setText(date.getMoney()+"");
        tvPlayType.setText(date.getPayType());
        tvTime.setText(date.getRechargeDate());
    }

    @Override
    protected void holder(View view) {
        initView(view);
    }

    private void initView(View view) {
        tvMoney = view.findViewById(R.id.tv_money);
        tvPlayType = view.findViewById(R.id.tv_playType);
        tvTime = view.findViewById(R.id.tv_time);
    }
}
